home *** CD-ROM | disk | FTP | other *** search
- TITLE: FED.EXE Version: 1.6
-
- PURPOSE: Non-interactive text file editor
-
- DATE: September 1993
-
- AUTHOR: Geoffrey H. Gillmer
- 18 Holmdene Road
- 7800 Plumstead
- SOUTH AFRICA
-
- DESCRIPTION: FED is a non-interactive text file editor. Files are
- processed one line at a time so that there is no restriction
- on the size of files which can be processed. Individual
- lines can be up to 32K in size. Edit commands (up to 100)
- are stored in a command file. The multiple edit operations
- are performed in a single pass.
-
- OPERATION: The command line invocation is:
-
- fed targetfile commandfile ─┘
-
- 1. "targetfile" is the text file to be converted and is any
- DOS path/file name. Multiple files may be specified by
- using the normal DOS wildcards (* and ?). However, the
- following restrictions are placed on specified target
- file names to prevent the accidental processing of non-
- text files:
-
- a) Only files with BAT, DOC or TXT extensions as well
- as CONFIG.SYS will be processed when using wildcards
- (* or ???) in the file name extension.
-
- b) For all other cases, files with BAK, COM or EXE
- extensions as well as the currently active
- commandfile will be automatically excluded.
-
- Original targetfiles are saved with a BAK extension
- provided modifications have been made. Note that
- this program will process read-only files.
-
- 2. "commandfile" is the unambiguous DOS path/file name
- which contains the string edit commands. Edit commands
- are described below. Although no restrictions are
- placed upon the commandfile name, for sake of clarity it
- is suggested that you adopt a consistent naming scheme
- for them, say, with a *.FED extension. If you use the
- FED extension for commandfiles, then the extension may
- be omitted.
-
- EXAMPLES . . .
-
- C> fed testfile.txt testfile.fed ─┘
-
- The above command line will process the input file
- "testfile.txt" using the command file "testfile.fed".
- The original "testfile.txt" will be retained as
- "testfile.bak" provided modifications were made.
-
- C> fed c:\util\*.bat bat.fed ─┘
-
- The above command line will process all files with a BAT
- extension in the "c:\util" subdirectory using the commandfile
- "bat.fed". Copies of the original files before conversion
- will be retained with BAK extensions.
-
- EDIT FED command files are ASCII text files which contain the
- COMMANDS: edit instructions used by the program. Up to 100 of these
- commands can be entered in a single file, one command per
- line. There is no practical limit to the length of a single
- command line (in theory these lines can be up to 32K in
- size). Blank lines will be ignored.
-
- string1//string2 will replace all occurrences of string1
- with string2.
-
- string1||string2 will replace lines containing string1 with
- the line string2.
-
- string1&&string2 will append string2 to lines containing
- string1. Trailing blanks in the lines
- with string1 will be removed before any
- modifications are made.
-
- string1^^string2 will prefix string2 to lines containing
- string1. The insertion will be made
- after any leading blanks to maintain the
- same line indentation.
-
- string1--[string2] will delete lines containing string1 and
- will optionally continue deleting lines up
- to and including the next line containing
- string2. Be careful of this one; if you
- specify string2 and a match is found for
- string1 but not for string2, then all lines
- from string1 will be deleted.
-
- string1~~ will delete all lines NOT containing
- string1.
-
- string1!!string2 will strip all occurrences of string2
- from lines containing string1.
-
- [string1]<<string2 will insert the line string2 ABOVE lines
- matched by string1. There is no
- restriction on the number of new lines
- which can be inserted above the same line
- matched by string1 (other than the 100
- command limitation). The line indentation
- (leading blanks) for string2 will be the
- same as that for the line containing
- string1. If string1 is omitted, then the
- line string2 will be placed at the
- beginning of the targetfile.
-
- [string1]>>string2 will insert the line string2 BELOW lines
- containing string1. There is a limitation
- of 50 line inserts below the same line
- matched by string1. The line indentation
- (leading blanks) for string2 will be the
- same as that for the line containing
- string1. If string1 is omitted, then the
- line string2 will be appended to the
- targetfile.
-
- NOTES . . .
-
- The string patterns for matching are not case sensitive.
-
- Blank spaces before string1 or after string2 in the
- commandfile are not significant. However, you can use an
- underscore to prefix a first blank space to string1 or to
- append a last blank space to string2. Any further blanks
- between the underscore and string1/string2 will then also
- become part of the strings.
-
- You can prefix a caret (^) to string1 (and/or string2 for the
- delete lines option only) to force the program to look for a
- match only at the beginning of the target lines(s). Note
- that leading blanks in the target lines are ignored when
- testing for matches. Do not therefore include blank spaces
- between the caret and the start of the search strings since
- these will also be ignored.
-
- Comments can be entered in a command file as lines by
- themselves, or set off from a command:
-
- ' This is a comment line by itself. Everything
- ' following a single quote will be treated as a
- ' comment.
-
- EXAMPLES . . .
-
- temp//tmp ' global change "temp" to "tmp"
-
- ^REM// ' remove "REM" from the beginning of
- ' lines only (leading blanks ignored)
-
- files=||files=40 ' replace lines containing "files="
- ' with line "files=40"
-
- ^files=||files=40 ' replace lines beginning with "files="
- ' with line "files=40"
-
- path&&c:\util; ' append "c:\util;" to lines
- ' containing "path"
-
- smartdrv^^REM_ ' prefix "REM " to lines containing
- ' "smartdrv"
-
- del *-- ' delete lines containing "del *"
-
- del *--^xyz _ ' delete lines containing "del *"
- ' and continue deleting up to and
- ' including the next line starting
- ' with "xyz " (leading blanks ignored)
-
- ^rem~~ ' delete all lines not beginning with
- ' "rem".
-
- cache!!/write=off ' strip "/write=off" from lines
- ' containing "cache"
-
- echo off>>cls ' insert line "cls" below lines
- ' containing "echo off"
-
- cls<<echo off ' insert line "echo off" above lines
- ' containing "cls"
-
- <<@echo off ' insert line "@echo off" at the
- ' beginning of the targetfile
-
- >>menu ' append line "menu" to the targetfile
-
-
- SPECIAL NOTE . . .
-
- The order of the edit commands in the commandfile may
- influence the results obtained. For example, consider
- the two following commands:
-
- smartdrv^^REM_ ' prefix "REM " to lines containing
- ' "smartdrv"
-
- REM !!REM_ ' strip "REM " from lines containing
- ' "REM "
-
- These will have no net effect on the line containing
- "smartdrv" since the first command will add "REM " while
- the following command will cancel this modification.
- However, if you swop the order of these commands in the
- commandfile, the line containing "smartdrv" will retain
- the "REM " addition.
-
- Note that it is not possible to modify or refer to newly
- inserted lines (using "||", ">>" or "<<" commands) via other
- edit commands in the same commandfile.
-
- DISCLAIMER: This program is distributed as shareware. Use it, copy
- it, upload it, give it to your friends. Please distribute
- only the complete program in ZIP form, including the
- document and example files. No warranties, either expressed
- or implied, are given by the author or distributor of the
- program, and the user accepts all risk of damage arising out
- of the application and use of the program.
-
- -----------------------------------------------------------
- Send comments/bug reports/contributions to:
-
- ╔═══════════════════════╗
- ║ G.H. Gillmer ║
- ║ 18 Holmdene Road ║
- ║ 7800 Plumstead ║
- ║ SOUTH AFRICA ║
- ╚═══════════════════════╝
- ===========================================================================
-
- VERSION HISTORY
- ---------------
-
- 1.32 (June 1993) First public release.
-
-
- 1.33 (June 1993) Append command (&&) changed to insert in front of
- trailing blanks.
-
- Prefix command (^^) changed to insert after leading
- blanks.
-
- Search strings anchored to the beginning of target
- lines now ignore leading blanks in the target lines
- when looking for matches.
-
- Documentation expanded.
-
-
- 1.34 (June 1993) The program now attempts to maintain the correct
- indentation when inserting new lines.
-
-
- 1.4 (July 1993) The names of files which can be processed made less
- restrictive.
-
- If the commandfile has a FED extension, then the
- extension may now be omitted when specifying the
- commandfile on the command line.
-
- A new command (~~) added which will delete lines NOT
- matching the specified search string.
-
- The maximum number of commands which can be stored in
- a commandfile increased from 50 to 100.
-
- The maximum number of inserts below the same line
- increased from 20 to 50.
-
- The program made more compact by omitting debugging
- code.
-
-
- 1.41 (July 1993) Reinstated debug code to re-enable ability to abort
- program execution by pressing Ctrl+Break.
-
-
- 1.6 (Sept 1993) The program will now process read-only files without
- errors.
-
- Indentation bug fixed.
-
- Bug relating to directory name extensions fixed.
-
- Ability to prefix and append lines to the targetfile
- added.
-
- Leading blanks in target lines now included in pattern
- searches.
-